Some coding adjustments to infinte loop madness