tidy up app/index.js and started on db layer and models