some refactoring
minor refactoring
threads
sync