Sage: clean up, removed a lot of unused code.