improved gamestate switching and killing threads