Fixes escape code 2J behavior

Also fixes a race between clearCanvas() and binaryGet()
It also removes duplicate code...

This supersedes  #5

Fixes #3