More refactoring for parameters, better testing