Minor tweaking and bug fixes.