Made some minor refactorings.