I like how you broke the checks down into semi-general functions, this is good practice.  It makes it easy if, for example at some point we want to pull that behaviour into a general module.