added .gitignore and some refactoring