Added database support to replace test code