major refactoring and added precommit script