deleted thread package + some refactoring