function ns_elem () { if (typeof arguments[0] === "undefined") { console.log('There was an error in the element assist function. Called with no valid tag name!');} var elem; if (typeof arguments[1] === "string") { elem = document.createElementNS(arguments[1], arguments[0]); for (var i=2; i -1) { // only splice array when item is found list.splice(index, 1); // 2nd parameter means remove one item only } } function appropriate_angle(point) { return -Math.atan2(point.x, point.y); }