First commit including junk from long ago. Works though.
Slightly simplified and cleaned up.
Pulling a license