Optimization

fixes #84
Merge pull request #85 from alograg/patch-2

Optimization