added category management and some cleanup