Additional encapsulation and code refactoring.