bitcount corrected
j, k correctly calculated