block number logic