Organised code into lib folder