Add preview next block functionality

Also Refactor the code a bit