Fixes #2610 - Replaces variable functions with call_user_func()

This is #497 (was #473) plus a cleanup commit. Resubmitting it because I can't test this immediately. @Srokap