First stab at #138, very difficult problem