Updated for ST3 and improvements.