started object-oriented rewrite