more work done: now only detector remains

plus a lot of testing! bugs expected...