Various improvements from code reviews