Added enpoint info. Implemented closing connection