refactor into byte array for bitmap loading