load native modules, fixes #39

Bug fixes and formatting on original PR by @mattapperson