AP gain

Pull for Issue #308