Connected controller to db. Creating functions now