Library concurency refactoring