refactor to use less bits