Merged DoubleChest fix and cleaned up some code.