new implementation with handling of threading