added QueryResult; fixes to findByQuery; implement countFoundRows; lots of other fixes and cleanup