fixed bugs and added in lines that change when blocks are added or merged