maybe simpler and faster to move this conditional outside of the promise?