Switched from artithmetic >> to logical >>> fixing several bugs.