cmp and branching w/ bug fixes