First draft of the new selector engine

A lot of work remains, and also optimizing. This can be used now,
therfor I upload it because there was errors / bugs in the old one.