updated to work w/ stdin