update promise syntax to use return type and handle optional null properly