Added error checking via simple -1 return code.