cleaning promises code