Reimplemented controller to use the database again