further cutdown, now reads from stdin