Flex and bug fixes