This breaks out each separate process into its own utility method, and adds javadoc to describe them.