Converted lengthy anonymous inner to named inner class.
Manual merge.