Now generates x vector correctly