Some jumbo jumbo code related to establishing connection to mpd server. But hey it works