Refactor database helper to avoid loading the app code