some refactorings for better multithreadingsupport