Add .gitignore, minor refactors