Simplified the parseTag function

A switch statement would be far more appropriate here.