moved some pure functions from app.js to utils