delete unused code and update coding style