added Result type and tests