[cyril] refactor cell code.