edited pseudocoded