removed debug code, added '-' param to read from stdin