More refactoring. Will finish later.
Minor edit.