Added next block logic + debug in sysout