added datatbase updating mechanism