Converting to promises
DRYing it out a bit