slighltly improved bitvector code