some codesmithing, minor edits