Make variable names more descriptive, remove debugging prints, move parameters onto fewer lines