fixed stupid error looping over wrong list
refactored to DRY
data type enum