code refactoring - replaced function pointer arguments with references