Added support for meta data in scripts. Moved some stuff around to streamline.