Moving code into runPseudoCron function