Removed math.sqrt dependency