refactoring data type access in script - does not yet work