added extra error handling when authenticate
fix fileblocks grunt task output
refactored app.js in multiple files