Use <0 checks in place of ==-1 because it results in simpler code.