Added Squared Magnitue function