Resolves #1 by removing global module dependency

Also adds unit tests