use more sensible variable names and tidy code