Initial tests, and lifecycle refactor