adding port for xdi2-selfhosted
renaming some variables
just moving one method position