Refactored setCell
Added a testcase that previously did not work as expected.