Merging the updated block placement algorithm

Incorporating the new block placement algorithm into the main branch as it has been tested thoroughly and works much better than the original algorithm.