major reorganization and modularization; use CLOS