Updated to read from file(Error fixed)