get/set bits + minor fixes
prepare for refactroing