added updateElement function and tested it.