fixed last few bugs, program now runs with expected level of output