various code style and logic edits
various posts edits