resolve #2, minor fixes, minor refactoring, update .gitignore