Quality assurance of pharmaceuticals