some structuring so it gets more readable
sg_inq is now taking a result and error arg