move code to seperate function 'split_host_and_port'