fixed query problems and removed obsolete classes