now program takes file name as input parameter and doesn't use stdin anymore.