remove some duplication
Remove unused variables
readability improvement