create Magic module, refactor CSV parsing