added some output to test values; modified pseudocode to be more specific