code cleanup and refactor - each and map for cells