some refactoring of spotify code