Lots of code clean ups, mostly of imports and added a license to xor.
Add a cache decorator.