Addition of SMS feature

Is `0` a valid error code? If so, consider making previousBg = -1.