Toscalib

Interim code checkpoint.
Refactored to match that suggestion, though I'm not 100% it's as you were asking, so please let me know if it's not.