added async and sync version