test refactoring
move debugging into separate thread