made controller cleaner and fixed up the query
fixed merge conflict in database.yml file