Added some checks for existing references and usings and removed redundant adding of loaded script