updated parser to accept istream objects