Refactored part of speech tagger