hw1 pseudo code improvements