Some refactoring
Flex serial changes