Trimming some code to make things easier to follow.