remove messy code and useless function