Some refactoring so variables are all held by params class