tidy up bitmap reading