Misc changes and cleanups, including fix for hit testing of bitmaps