refactor and new code added