Using a URL type and setting the scheme would save the if/else's below from haivng to happen too.