add tests and make resume asynchronous