refactor the manager

major refactoring of the manager. It simplify a lot the way the connections
are supervised also it optimize the usage of ets by removing extra call to the
main ets that keeps temporary states. It also fix the memory leaks.