Add history depth

Works but kind of mem-wasty.