fix messy code