First refactoring before probable migration to NetBeans platform.