Clean class and function
Remove unnecessary member variables. Store iterator value for code simplification.