Used functions instead of xFactor and yFactor
Used functions instead of xFactor and yFactor