Added write, read and error returns.