Refactored some code into a common util file
added .gitignore