Better tag parsing