refactor code and add modify panel