remove slash from file name
add more constants
new function
greatly simplify cdf writing; move scId and co to data manager