added comments and minor refactoring
added ignore