Bug 920823 - Code cleanup and other improvements. r=mwu