refactor based on javascript functional pattern and node module.exports pattern