working transform math and replacement