Improved the logic that detects which functions should be recompiled