changed file() to open() as per documentation recommendation