Updated code to fetch default endpoint, code moved to PreHandlers