Materials Science Forum, 651, pp. 11-25, May 01, 2010, DOI: 10.4028/www.scientific.net/MSF.651.11The material in this document is covered by the provisions of the Copyright Act, by Canadian laws, policies, regulations and international agreements. Such provisions serve to identify the information source and, in specific instances, to prohibit reproduction of materials without written permission. For more information visit http://laws.justice.gc.ca/en/showtdm/cs/C-42Les renseignements dans ce document sont protégés par la Loi sur le droit d'auteur, par les lois, les politiques et les règlements du Canada et des accords internationaux. Ces dispositions permettent d'identifier la source de l'information et, dans certains cas, d'interdire la copie de documents sans permission écrite. Abstract. The TOPAS macro language can be a powerful tool for increasing the capabilities of X-ray powder diffraction analysis. New corrections and constraints can be implemented without altering the program's code, allowing for experimentation with new ideas and approaches. Examples are given, exposing the power and flexibility of the macro language to help solving problems with a few lines of code. The use of simulated annealing for structure solution of an organic material from data exhibiting preferential orientation is one example.Another one is about extraction of useful structural information in Rietveld refinement of natural hydrotalcite-group minerals, a problematic case that would normally be regarded as over-parameterized for the data available.