Add gitignore and minor bug correction