Javascript refactor and add description tooltip to output