reworked hasnext and popnext
made changes to hasnext and popcommit