Refactoring in catalog.coffee

Simplifying some bits of @LDHgithub's pull (#642), and commiting as one commit.

This shouldn't change any logic, but @mzedeler - do you have time for a quick review, now that both Lars and I have been involved in this?