Wrote the code in the ElementAction class