Moved custom modules to a lib folder and did some general tidying.