Cleaned up db_helpers code