Include schaefer0's changes with a few formatting fixes