Added optional file parameter which was missing in the method.