Rewrite the entire thing to use a worker and channels