added database abstraction layer