Sega. Add Demchenko test, rewrite main. Need to merge with Ekr part