First, we initialize integer to 256 to save a byte. :) Then, in the PM code we use (integer = integer >> 1), instead of (integer = integer - 1).
(integer = integer >> 1)
(integer = integer - 1)
If I'm right (which I rarely am), this would be smaller, faster and smarter. How does it sound to you?