refactor code added