refactor playlist function from utils to playlist