Refactor `Linearizer`, convert methods to async and use an async context manager.