created pseudo-code