Initial logic and tests