Made algorithm for generating blocks from txt