general approach implemented, but with problems
cursor location added