Added tests, made it so you can call it better asynchronously.