Refactoring and working on matrix params