change localfile function accordingly