Added more explicit cell type handling.