origin support in protocol
removed dead code
better logging and wildcard support