Proper determination of powers of two instead of popcount; Fixed typo and added test cases