Maybe an intended return with -1 to signal error would be a cleaner interface?