pseudo-code insertFork