added proper sleep