functional convert code