Refactor dewarp code into separate module, implement live preview