Remove duplicate end statement