Refactoring main and fixing domain extraction.

Main is now much more readable and there is less code repetition.

Domain extraction would fail if there was no protocol and insert nonsense into
domain. This is now fixed by using the knowledge that the protocol will always
be something like http:// where the key part is the two slashes.

Also fixed YCM not acknowledging size_t as a type.