Minor performance improvements (mostly string compare)