fix to do. refactor variable, delete unused code