refactoring
delete unused/redundant variables
reformat/fix spacing