Refactoring to prepare for expansion/contraction stuff.
Added BitImage datastructure