various small improvements and changes made, nothing big

github strangely treats the indenting of big blocks of code as insertions and then deletions... huh.