Minor changes and introduction of anonymous namespace for helper functions