Refactored to resemble npm module.
Created simple unit test.