Make 2 functions static, remove unneeded cast, rewrap. No behavior change.
Reformat a couple of functions for clarity.