refactor code for db