Amended Homework one with a nice flip implementation