Formatting and return err, instead of nil