Why are you using your custom `isPowerOfTwo ` function here?