finish refactor, delete unused variable