some cleanup and basic category implementation