Placed all relevant code into lib folder