Refactored cell code.