Updates to allow loading of external scripts and added tests