refactoring to match common js module pattern