Optimization of the code
changing the way the edit panel works