working and tested code for finding max radius source