Fixed validation code. Default case was inside a loop.