Added remaining code from the port changes file