Added selective dynamics code