Working version, uses mappings from array and definition file