centralizing parameter handling, and other cleanup