refactored even more to promises.