Remove 'err' utility function, replace with inline error handling.

Reformatted codebase while at it, will add some comments and new-
lines next.