added sleep to api