Performance optimization for fix for issues 51 and 60