Renamed vars and removed magic numbers