Refactoring marching square class