Rename some variables and create single method for rounding to avoid duplication