parse refactor to promises