Add categories and plenty of bug fixes