Time optimization: Taking out DB build from main file