Add flex function to code viewer