add OSX files to gitignore
Add code optimsations according to suggestions.