restructured code and added setup for pre/post commit hooks