54f14c0492
Simplify may be in the eye of the beholder here. This reduces code duplication, as both parts are effectively the same. Part 2 just has an extra operation that can be carried out.