Fixed conversion, still ugly but works somewhat