Fixed gitignore and did minor refactorings