Add simple logging and test whether N is a power of 2