Fixed some require paths.
Moving some code out of the lib.