added a bunch of infrastructure to interact between the view and database
fixed merge