Refactor. renamed some variables.