collecting repeated code into a single function
adding ParamWin class