Bunch of work, fixed the issue I caused last time

Basically every line was checked for tags, which would cause issues if they had words in parenthesis elsewhere. Now it just checks the first line. Also refactored some stuff.