Lots of cleanups, output stage fixes, parameter tweaks