fixed equations, now works