modify messy code