major code cleanup of cfax template