Added support for custom block references and defs

This change also adds initial implementation of the script tag which is
used for the bodys of most functions.