Made more changes to return values and ways to see errors.

The static error value has been removed, because it wouldn't be thread-safe.
Instead all functions that needed it have extra argument to which the error value will be assigned into or if they didn't return anything before, then now they'll return the error value.
Removed unnecessary variable names in a typedef.