Removing extra 'end'