(#16) - exit earlier, minor optimization

Tests are passing here and in mapreduce.