change return value for errors to negative values - this makes it harder to mistake them as indicators for success