little refactor and unittest on type parsers