Fixed dynamics code