moved required var access to end of rule conditions to avoid early warnings