added selective dynamics code