minor changes, mostly input-output format