added foreseeing capability, but it didn't help; criteria needs redesign;
* a lot of castings in this commit