Various code changes. Still a sinful amalgam of code