added function to write gamestate and response at the same time
modified worker