refactor: minor code cleanup / fixes

@mhevery this PR cleanups your branch and fixes some minor items. I'll use this as a starting point for my coming work on change detection.