Reformat internals, fix log messages