Minor refactoring. Getting ready to add function pointer support