bit counting algorithm done, maybe re-do if we have time