fix the messy code