delete unused code and support update function