cleaning out nits and using logical comparison, removed else-if testing