Change indexname for input from stdin

and some cosmetic changes.