makes reading from file more general