added sfolder, fixed file opening to be compatible with macs