Attempt to make this code slightly easier to read.