Fixed some bugs. Added dialog for endpoint.