changed the way that cursor movement is handled

and a view other minor changes.