clueanup

broadly speaking if there is a parameter passed into a function that selects specific behaviour to be executed then further stepwise refinement is required; Breaking up this function into smaller functions will produce more highly cohesive ones.