Interface definition and major refactoring.