adding pen update and movement code & tables