mrec code , validating