Some refactoring to application and DB provider