Moved some of the lib functions into seperate files
Moved some lib functions into separate files