refactored modules to work for server.js