refactored catalog code