Remove useless code and clean some methods