Tweaks/cleanups provided by Matthew Dempsky