wrote pseudo codes