math optimization & shadow