Fix whitespace detection method

- Fix method used to generate whitespace around newly added parameters
- Add tests for adding new parameters