new Cscanner implementation almost finished