implemented getNextHeadPosition in CommonMethods