some refactoring to make localParams usable everywhere