refactor to make it ready for express-basic-app integration