some cleanup, and some stuff around category and functor