reworking callbacks to promises