CHANGE: some rules simplified
CHANGE: tag stack stores two values per tag (name is separate)