Fixed issue #70

Fixed #70 by refactoring inner classes into standalone classes in order
to prevent errors in the OS X runtime.
Merge branch 'hotfix'