corrected procedure at end