Remove implicit bool conversion
Added sorting in $BuildMethodGroups based on distance from type. Fix #368.