Changed to use bitwise operations for the power of 2