Added async support and changed the interface to callbacks