register method. Move to app.js