Added marching squares cases and double buffering