Cleaned up protocol, adding tests