solve the messy code bug.