Remove unused connect module
Seperate middleware logics to their own function
Merge pull request #325 from gergelyke/develop

Minor improvments