Added snapshot command tests. Minor refactoring.