Performance improvements
Code clean up
Merge pull request #111 from Boris-Em/Bug/107

Bug/107