Get ip address in seperate function