now uses x-y Eucliean distance in if statment