Added initial DB support and a lot other stuffs