fixed database interactions, should be fully functional now