improves performance by changing the bit test to conditions.
see the README for more details on this change.