Added default value for the choices property. Refactore the if statements to follow our codeing guideline.