setup positionHandler and writeHandler