Clean up messy code