Issue/#41

- Fixes #41
- Minor code re-factoring.