Wait until one of 'success', 'error' is returned

This solves issue #5.