refactored some duplicated code into _modifyCell method.