better way of opening file?