clean up
removed redundant code
removed first_category logic
removed unused function
general cleanup. fixes #6 and #7