added default logic for the last remaining cell