edit code in Block to pagenator, optimization code