Refactored a few utility functions, moved libraries into their own folder