make read_sv responsible for setting tag
tag was just an alias to in[-1]
rewrite for as do-while to remove duplication