Merge "Code refactoring on Macros related to ref frame numbers" into nextgenv2