added back equations in code