Updated changes for x**n -> Math.pow(x, n) and fixed typo with xPosition -> x