changed the subtaraction to a flip