Move JOIN processor into function