experimental port manipulation code