use Crockford's if-else style