Moving javascript from the view file. Added method to only provide existing tag options