Remove duplicates and bad code habits.