optimazing the db class and increase id in db