Moded two implementation into their own functions

Also general tidy up

Refs #10215