code with retrievelling