Several code tweaks.