Add iterative method for parsing params and refactor recursive method