Add spotify openURL support. Restructure some code