Adding function to check if port is used