Refactor to use when
Basic import to existing table working