Various code improvements.