Sort out types. needs much refinement
reorg
Use SSL
Refactor