made usage of next optional