Add calls to sanitisation functions and various other improvements.