Build just tree

refactored catalog code