Changed self reference prohibition to only address 'function' nodes; moved code to controller.js to match current code.