Rearranged and recategorized libraries

Based on discussion #2.