Added code for generating database