Misc improvements, comments, and cleanup