Refactor: renamed some parameters
Refactor: Eliminated unnecessary function wrapping
Refactor: Eliminated unnecessary function wrapping
Refactor: Using free variables to reduce the number of parameters in some functions