Consider making -1 a class constant instead of using it as a magic number. But this is unrelated to this pull request.