Reindent, add namespaces to types, etc

Also fix the restrictions