Changed to take vectors into account.