coding style issue:

if should be 
} else if (....