Added a check for impossible situations and fixed an edge case that hid any cases where exact change was possible.