Moved parameter handling further up and added host parameter (requires IPv4)