make it stop properly
move port into the code fragment