Moved database management to Application class