Gitignore added. Code refactored