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.