real: some cleanup and test additions.