Removed function already implemented in the standard library.
Added WrapError function and used it. Replaced calls to fmt.Errorf
with errors.New. Other cleanup.