Added Title logic and updated if statement logic

Hierarchy for which metadata field is used is now Display Name, Title, then Name. Also, switched the if statement to checking the node itself rather than Velocity variable because of weird programming language functionalities.