debugged scanline
merged Raph's work