switched back to fgets(STDIN) from readline() for portability