change to use input from stdin