Add missing end and remove old code accidentally pasted before previous commit.