added flextags and changes names of some vars