This series aims to improve the code quality of the profile module. It's not actually as bad as it looks, since non of these changes are extensive. Most of these changes can be summed up as 'use the lazy version of a builtin function'. The majority of the code is in the first two patches, which add tests for the profile module.