parameterization, and improved cleanup