refactor the base classes a little (bug 846826)