added category functionality, fixed small bug