move to worker
put things in functions