Almost done except test code