Extracted logic into their own procedures.
Added a sneaky test.