Added psuedo code