Fix max distance bug. Added large string tests