updated Armadillo codes, added changing mode