Fixing bitmap bug. Also speeding it up.