Cleaned up database helper