[WIP] Move the spa global in the worker into tkWorker

This moves the `spa` global variable into `tkWorker`. This helps encapsulation and makes it easier to write tests which I need in a future PR.

WIP as I suggest this lands after PR #363 to simplify bitrot.