First pass psuedo code