cleaned up some database calls