refined renderFile functionality