Added radio buttond and refactored the code