Added Blockhalving
cleaned up some code