Rename some private variable and remove duplicate code in function CountParameter