Implemented and tested ParseConnectionChainMiddle and fixed some bugs.