Fix wrong var name
Tidy code