fixes for main and end-to-end. Main for jar file now reads/writes to stdin