refactored code for params processing to vars