Version 6 -- Some minor code refactoring.