abstracts cell rotation logic