Standardise getting and checking elements in dom
Added new script for generating references