pseudo code for extract value