Simplifying this black box

This is how it should be structured and work.

Only outstanding item I can think of at the moment:  getting SSL working properly.