changed code for dynamic elements again