clean up messy code