Better distance checking
Updated read