move stuff away from app.js into seperate lib modules