Replaced ^ by Math.pow